package com.linjuke.childay.common;

import android.location.Location;
import android.util.DisplayMetrics;

import com.linjuke.childay.androidext.ChildayApplication;
import com.linjuke.childay.locationex.GeoPointExt;

public class MobileUseInfo {
	
	private String mac;
	
	private String mobile;
	
	private String netWork;
	
	private int width;
	
	private int height;
	
	private static MobileUseInfo mobileConfig = new MobileUseInfo();
	
	private ChildayApplication childayApplication;
	
	private MobileUseInfo() {
		
	}
	
	public static MobileUseInfo getMobileUseInfo() {
		return mobileConfig;
	}
	
	public void init(ChildayApplication childayApplication) {
		this.childayApplication = childayApplication;
		this.mac = AndroidUtil.getMacAddress(childayApplication);
		this.mobile = android.os.Build.MODEL + "/"
		+  android.os.Build.VERSION.SDK + "/"
		+  android.os.Build.VERSION.RELEASE;
		this.netWork = AndroidUtil.getNetwork(childayApplication);
		
		DisplayMetrics dm = childayApplication.getResources().getDisplayMetrics();
		width = dm.widthPixels;
		height = dm.heightPixels;
	}
	
	public GeoPointExt getLocation() {
		Location location = childayApplication.getMyLocation();
		if (location == null) {
			return new GeoPointExt(0, 0);
		}
		return LocationUtil.asGeoPoint(location);
	}
	
	public String getMac() {
		return mac;
	}

	public void setMac(String mac) {
		this.mac = mac;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getNetWork() {
		return netWork;
	}

	public void setNetWork(String netWork) {
		this.netWork = netWork;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

}
